<%@ page import="java.util.LinkedList" %>
<%@ page import="java.util.Date" %><%--
  Created by IntelliJ IDEA.
  User: user
  Date: 2025/3/20
  Time: 10:00
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<%
    request.setAttribute("username","tom");
    LinkedList ls=new LinkedList();
    ls.add("张三");
    ls.add("李四");
    ls.add("王五");
    ls.add("赵六");
    session.setAttribute("listdata",ls);
%>
<%--out标签的用法--%>
<c:out value="${username}"></c:out>
<br/>
<%--if标签的用法--%>
<c:if test="${not empty requestScope.username}">
    您好：${requestScope.username}
</c:if>
<br/>
<%--choose标签的用法--%>
<c:choose>
    <c:when test="${not empty sessionScope.username}">
        欢迎您：${sessionScope.username}
    </c:when>
    <c:otherwise>
        欢迎您：游客
    </c:otherwise>
</c:choose>
<br/>
<%--foreach标签的用法--%>
<c:forEach items="${sessionScope.listdata}" var="ls" varStatus="status">
    ${status.index+1},${ls};
</c:forEach>
<br/>
<%--100以内的奇数--%>
<c:forEach begin="1" end="100" step="2" var="num">
    ${num}
</c:forEach>
<br/>
<%--使用foreach实现九九乘法表--%>
<c:forEach begin="1" end="9" var="i">
    <c:forEach begin="1" end="${i}" var="j">
        ${i}*${j}=${i*j} &nbsp;
    </c:forEach>
    <br/>
</c:forEach>
<%--时间日期格式化展示--%>
<fmt:formatDate value="<%=new Date()%>" pattern="yyyy-MM-dd HH:mm:ss"></fmt:formatDate>
</body>
</html>
